package com.qeegoo.b2bautozityp.moudle.inquiry.viewmodel;

import android.databinding.ObservableField;
import android.view.View;

import com.qeegoo.b2bautozityp.api.HttpParams;
import com.qeegoo.b2bautozityp.api.RequestApi;
import com.qeegoo.b2bautozityp.api.RetrofitService;
import com.qeegoo.b2bautozityp.moudle.inquiry.model.InquiryListBean;
import com.qeegoo.b2bautozityp.utils.AdapterInterface;

/**
 * Created by lining on 2017/9/29.
 */

public class InquiryListViewModel {

    private RequestApi mRequestApi;
    public ObservableField<Integer> emptyVisible = new ObservableField<>(View.GONE);
    private AdapterInterface<InquiryListBean> adapterInterface;

    public InquiryListViewModel(RequestApi requestApi) {
        mRequestApi = requestApi;
    }


    //列表
    public void getDatas(String pageNo,String tag) {
        mRequestApi.showAskPriceOrderList(HttpParams.showAskPriceOrderList(pageNo,10+"",tag))
                .map(new RetrofitService.HttpResultFunc<>())
                .compose(RetrofitService.applySchedulers())
                .subscribe(inquiryListBean -> {
                    adapterInterface.callBackData(inquiryListBean);
                });
    }

    public void setAdapterInterface(AdapterInterface<InquiryListBean> orderResultBeanAdapterInterface){
        this.adapterInterface = orderResultBeanAdapterInterface;
    }
}
